# -*- coding: utf-8 -*-
# Python中默认的编码格式是 ASCII 格式，在没修改编码格式时无法正确打印汉字，所以在读取中文时会报错。


import sys

a = 100
b = True
d = 1.1
e = ""
f = []
f1 = [23]
g = ()
h = {}
i = set([])

print (" %s size is %d " % (type(a), sys.getsizeof(a)))
print (" %s size is %d " % (type(b), sys.getsizeof(b)))
print (" %s size is %d " % (type(d), sys.getsizeof(d)))
print (" %s size is %d " % (type(e), sys.getsizeof(e)))
print (" %s size is %d " % (type(f), sys.getsizeof(f)))
print (" %s size is %d " % (type(f), sys.getsizeof(f1)))
print (" %s size is %d " % (type(g), sys.getsizeof(g)))
print (" %s size is %d " % (type(h), sys.getsizeof(h)))
print (" %s size is %d " % (type(i), sys.getsizeof(i)))

# https://blog.csdn.net/weixin_39693193/article/details/113387127
# python中整型结构中的数组，每个元素最大存储 15 位的二进制数(不同位数操作系统有差异32位系统存15位，64位系统是30位)。
# 因此，sys.getsizeof(0) 数组元素为0。此时占用24字节(PyObject_VAR_HEAD 的大小)。 sys.getsizeof(456) 需使用一个元素，因此多了4个字节。

#  <type 'bool'> size is 12
#  <type 'long'> size is 14
#  <type 'float'> size is 16
#  <type 'str'> size is 21
#  <type 'list'> size is 36
#  <type 'tuple'> size is 28
#  <type 'dict'> size is 140
#  <type 'set'> size is 116
